home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Online / AWeb / awebjfif68060 / awebjfif.awebrx < prev    next >
Text File  |  2002-10-28  |  7KB  |  194 lines

  1. /* awebjfif.awebrx - Install or uninstall the AWeb JFIF plugin */
  2.  
  3. options results
  4.  
  5. if left(address(),5)~="AWEB." then do
  6.    ports=show("P")
  7.    parse var ports dummy "AWEB." portnr .
  8.    if portnr="" then do
  9.       address command "run AWeb3:AWeb-II"
  10.       address command "WaitForPort AWEB.1"
  11.       portnr=1
  12.    end
  13.    address value "AWEB."portnr
  14.    'get activeport'
  15.    address value result
  16. end
  17.  
  18. parse arg args
  19. parse source dummy1 dummy2 called .
  20. i=lastpos(called,'/')
  21. if i==0 then i=lastpos(called,':')
  22. if i>0 then path=left(called,i)
  23. else path=''
  24.  
  25. if args='' then do
  26.    if ~open(tf,"T:awebjfifsetup.html","W") then exit
  27.  
  28.    call writeln tf,"<html><head><title>AWeb JFIF Setup</title></head>"
  29.    call writeln tf,"<body><h1>AWeb JFIF Setup</h1>"
  30.    
  31.    if exists("AWebPath:awebplugin/awebjfif.awebplugin") then do
  32.       installed=0
  33.       progress=4
  34.       multipass=1
  35.       dither=2
  36.       grayscale=0
  37.       maxmem=1024
  38.       lowpri=0
  39.       'getcfg MIME stem m'
  40.       do i=1 to m.0
  41.          if upper(left(m.i.value,11))="IMAGE/JPEG;" then do
  42.             parse var m.i.value type ";" ext ";" action ";" file ";" args
  43.             if action='A' & upper(right(file,19))="AWEBJFIF.AWEBPLUGIN" then do
  44.                installed=1
  45.                j=index(upper(args),"PROGRESS=")
  46.                if j>0 then do
  47.                   progress=substr(args,j+9)
  48.                   j=verify(progress,"0123456789")
  49.                   if j>0 then progress=left(progress,j-1)
  50.                end
  51.                j=index(upper(args),"MULTIPASS=")
  52.                if j>0 then multipass=substr(args,j+10,1)
  53.                j=index(upper(args),"DITHER=")
  54.                if j>0 then dither=substr(args,j+7,1)
  55.                grayscale=(index(upper(args),"GRAYSCALE")>0)
  56.                j=index(upper(args),"MAXMEM=")
  57.                if j>0 then do
  58.                   maxmem=substr(args,j+7)
  59.                   j=verify(maxmem,"0123456789")
  60.                   if j>0 then maxmem=left(maxmem,j-1)
  61.                end
  62.                lowpri=(index(upper(args),"LOWPRI")>0)
  63.             end
  64.             leave
  65.          end
  66.       end
  67.       
  68.       call writeln tf,"<table border width=100% bgcolor=#aaccaa><tr><td>"
  69.       call writeln tf,"<form action='x-aweb:rexx/"called"'>"
  70.       call writeln tf,"This form configures AWeb-II to use the <strong> AWeb JFIF plugin</strong>."
  71.       call writeln tf,"<input type=hidden name=defprogress value="progress">"
  72.       call writeln tf,"<ol><li>Select the required modes of operation "
  73.       call writeln tf,"(see <a href='file:///AWebPath:awebplugin/docs/awebjfif.html#parameters'>documentation</a> for details)"
  74.  
  75.       call writeln tf,"<p><ul><li>Progressive display:<br>"
  76.       call writeln tf,"<input type=radio name=progress value=0"
  77.       if progress=0 then call writeln tf," checked"
  78.       call writeln tf,"> No progressive display (fastest)<br>"
  79.       call writeln tf,"<input type=radio name=progress value=4"
  80.       if progress=4 then call writeln tf," checked"
  81.       call writeln tf,"> Standard progressive display<br>"
  82.       call writeln tf,"<input type=radio name=progress value=1"
  83.       if progress=1 then call writeln tf," checked"
  84.       call writeln tf,"> Smooth progressive display (slowest)<br>"
  85.  
  86.       call writeln tf,"<p><li>Display "progressive" JPEG images:<br>"
  87.       call writeln tf,"<input type=radio name=multipass value=0"
  88.       if multipass=0 then call writeln tf," checked"
  89.       call writeln tf,"> The final image only (fastest)<br>"
  90.       call writeln tf,"<input type=radio name=multipass value=1"
  91.       if multipass=1 then call writeln tf," checked"
  92.       call writeln tf,"> Several passes with increasing image quality<br>"
  93.  
  94.       call writeln tf,"<p><li>Dither mode. This will only take effect on screens with 256 colours or less.<br>"
  95.       call writeln tf,"<input type=radio name=dither value=0"
  96.       if dither=0 then call writeln tf," checked"
  97.       call writeln tf,"> No dithering (fast but low quality)<br>"
  98.       call writeln tf,"<input type=radio name=dither value=1"
  99.       if dither=1 then call writeln tf," checked"
  100.       call writeln tf,"> Ordered (medium quality, medium speed)<br>"
  101.       call writeln tf,"<input type=radio name=dither value=2"
  102.       if dither=2 then call writeln tf," checked"
  103.       call writeln tf,"> Floyd-Steinberg (good quality but slower)<br>"
  104.       
  105.       call writeln tf,"<p><li><input type=checkbox name=grayscale value=GRAYSCALE"
  106.       if grayscale>0 then call writeln tf," checked"
  107.       call writeln tf,"> Grayscale images"
  108.       
  109.       call writeln tf,"<p><li>Maximum scratch memory usage per image during the decoding process."
  110.       call writeln tf,"If more memory is needed, a virtual memory system will be used.<br>"
  111.       call writeln tf,"<input name=maxmem size=8 value="maxmem"> kB"
  112.       
  113.       call writeln tf,"<p><li>Multitasking:<br>"
  114.       call writeln tf,"<input type=checkbox name=lowpri value='LOWPRI'"
  115.       if lowpri then call writeln tf," checked"
  116.       call writeln tf,"> Run decoder at low priority<br>"
  117.  
  118.       call writeln tf,"</ul>"
  119.       call writeln tf,"<p><li><input type=checkbox name=save value=yes checked> Save the new settings"
  120.       call writeln tf,"<p><li><input type=submit value='Install AWeb JFIF plugin'>"
  121.       call writeln tf,"</ol></form></table>"
  122.  
  123.       if installed>0 then do
  124.          call writeln tf,"<p><table border width=100% bgcolor=#ccaaaa><tr><td>"
  125.          call writeln tf,"<form action='x-aweb:rexx/"called"'>"
  126.          call writeln tf,"<input type=hidden name=deinstall value=''>"
  127.          call writeln tf,"This form will deinstall the AWeb JFIF plugin and reset the default (datatypes) decoder for JFIF images."
  128.          call writeln tf,"<ol><li><input type=checkbox name=save value=yes checked> Save the new settings"
  129.          call writeln tf,"<p><li><input type=submit value='De-install AWeb JFIF plugin'>"
  130.          call writeln tf,"</ol></form></table>"
  131.       end
  132.  
  133.    end
  134.    else do
  135.       call writeln tf,"Plugin file not found. You have to run the install script first."
  136.    end
  137.    
  138.    call writeln tf,"<p><hr><p><a href='file:///AWebPath:awebplugin/docs/awebjfif.html'>Back to documentation</a>"
  139.    
  140.    call close tf
  141.    'open "file:///T:awebjfifsetup.html" reload'
  142.    'wait "file:///T:awebjfifsetup.html"'
  143.    'allowcmd'
  144.    address command 'delete T:awebjfifsetup.html quiet'
  145.  
  146. end
  147. else do
  148.    
  149.    ext="jpg jpeg jfif"
  150.    rest=";"
  151.    
  152.    'getcfg MIME stem m'
  153.    do i=1 to m.0
  154.       if upper(left(m.i.value,11))="IMAGE/JPEG;" then do
  155.          parse var m.i.value type ";" ext ";" action ";" rest
  156.          leave
  157.       end
  158.    end
  159.  
  160.    if upper(left(args,9))="DEINSTALL" then do
  161.       mime="IMAGE/JPEG;"ext";;"rest
  162.    end
  163.    else do
  164.       progress=""
  165.       defprogress="4"
  166.       multipass="1"
  167.       dither="2"
  168.       grayscale=""
  169.       maxmem="1024"
  170.       lowpri=""
  171.       save=""
  172.       
  173.       do while args~=""
  174.          parse var args nextarg args
  175.          interpret nextarg
  176.       end
  177.       
  178.       if progress="" then progress=defprogress
  179.       mime="IMAGE/JPEG;"ext";A;AWebPath:awebplugin/awebjfif.awebplugin;PROGRESS="progress" MULTIPASS="multipass" DITHER="dither" "grayscale" MAXMEM="maxmem lowpri
  180.    end
  181.    
  182.    'setcfg MIME "'mime'" ADD'
  183.  
  184.    if upper(save)="YES" then do
  185.       'savesettings'
  186.    end
  187.  
  188.    'open "file:///AWebPath:awebplugin/docs/awebjfif.html"'
  189.  
  190. end
  191.  
  192. exit
  193.  
  194.